home *** CD-ROM | disk | FTP | other *** search
/ PC-X 1997 October / pcx14_9710.iso / swag / delphi.swg / 0026_Capturing the Desktop to a form.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1995-11-22  |  457 b   |  22 lines

  1.  
  2. Try this:
  3.  
  4.  procedure TScrnFrm.GrabScreen;
  5.  var
  6.  
  7.     DeskTopDC: HDc;
  8.     DeskTopCanvas: TCanvas;
  9.     DeskTopRect: TRect;
  10.     
  11.  begin
  12.     DeskTopDC := GetWindowDC(GetDeskTopWindow);
  13.     DeskTopCanvas := TCanvas.Create;
  14.     DeskTopCanvas.Handle := DeskTopDC;
  15.  
  16.     DeskTopRect := Rect(0,0,Screen.Width,Screen.Height);
  17.  
  18.     ScrnForm.Canvas.CopyRect(DeskTopRect,DeskTopCanvas,DeskTopRect);
  19.  
  20.     ReleaseDC(GetDeskTopWindow,DeskTopDC);
  21. end;
  22.